<template>
  <div class="page-panel">
    <PageTitle
      :title="panelTitle"
      v-bind="$attrs"
      @clickClose="clickClose"
    ></PageTitle>
    <div class="content">
      <slot></slot>
    </div>
  </div>
</template>

<script>
// 用法:不绑定clickClose事件的时候，也会关闭面板，绑定clickClose会把关闭事件传出去

import PageTitle from "@/components/PageTitle/index.vue";
export default {
  name: "PagePanel",
  components: { PageTitle },
  props: {
    panelTitle: String,
  },
  mounted() {},

  methods: {
    clickClose() {
      this.$store.commit("setActivePanel", {
        panelId: "",
        panelTitle: "",
      });
      this.$emit("clickClose");
    },
  },
};
</script>
<style lang="less" scoped>
.page-panel {
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #409eff;
  box-shadow: inset 0 0 20px 2px 409EFF;

  box-sizing: border-box;
  width: 320px;
  height: 100%;
  color: #fff;
  position: relative;
  transition: all ease 0.3s;
  overflow: hidden;

  .content {
    pointer-events: auto;
    background-color: #fff;
    height: 720px;
    box-sizing: border-box;
    width: 100%;
    // height: calc(100% - 42px);

    padding: 12px 12px 20px;
  }
}
</style>
